<script>
export default {
    name: 'TabSwitching',
    props: {
        data: {
            type: Array,
            default: () => []
        },
        account: {
            type: Number,
            default: 0
        }
    },
    methods: {
        toPath(path) {
            this.$router.push(path);
        }
    }
};
</script>

<template>
    <div class="tab-switching">
        <div class="tab-switching__item" v-for="(item, index) in data" :key="index" :class="{ active: index === account }" @click="toPath(item.path)">
            {{ item.name }}
        </div>
    </div>
</template>

<style scoped>
.tab-switching {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    gap: 10px;
}
.tab-switching__item {
    font-size: 14px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s;
    background: #99ccff;
    padding: 5px 10px;
    border-radius: 4px;
}
.tab-switching__item.active {
    background: #3399cc;
    font-weight: 700;
}
</style>
